const {
    createProxyMiddleware
  } = require('http-proxy-middleware');
  
  module.exports = function (app) {
    app.use(
      '/api',
      createProxyMiddleware({
        //目标地址
        target: 'http://localhost:8989',
        //伪装身份为目标地址
        changeOrigin: true,
        //去掉前缀
        pathRewrite: {
          '^/api': ''
        }
      })
    )
  };